package com.neusoft.elmboot.exception.exceptions;

import com.neusoft.elmboot.util.response.CodeEnum;
import com.neusoft.elmboot.util.response.ResultBody;

public class ErrorStateException extends BaseException{
    public ErrorStateException(){
        this.code = CodeEnum.STATE_ERROR;
        this.msg = "";
    }

    public ErrorStateException(String msg) {
        this.code = CodeEnum.STATE_ERROR;
        this.msg = msg;
    }

    @Override
    public ResultBody getResult(){
        if (this.msg == null) {
            return new ResultBody(CodeEnum.STATE_ERROR);
        } else {
            return new ResultBody(CodeEnum.STATE_ERROR.getResultCode(), msg, null);
        }
    }
}
